/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nuboat.easyjsf.facade;

import com.nuboat.easyjsf.entity.UsersEntity;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author caroljmcdonald
 */
@Stateless
public class UserFacade implements Serializable {

    @PersistenceContext
    private EntityManager em;

    public void create(UsersEntity item) {
        em.persist(item);
    }

    public void edit(UsersEntity item) {
        em.merge(item);
    }

    public void remove(UsersEntity item) {
        em.remove(em.merge(item));
    }

    public UsersEntity find(Object id) {
        return em.find(UsersEntity.class, id);
    }

    public List<UsersEntity> findAll() {
        return em.createNamedQuery("UsersEntity.findAll").getResultList();
    }

}